package MVC;

/**
 * Controller
 * @author deathbyaclown/André Uhres
 */
import javax.swing.*;
 
public class WindController {
 
    private Wind wind;
 
    public WindController() {
        WindViewer viewer = new WindViewer(this);
        wind = new Wind();
        wind.addObserver(viewer);
    }
 
    public void changeDirection() {
        Direction[] dir = Direction.values();
        wind.setDir(dir[(int) (Math.random() * 4)]);
    }
 
    public void changeSpeed() {
        wind.setSpeed((int) (Math.random() * 100));
    }
 
    public static void main(final String[] args) {
        Runnable gui = new Runnable() {
 
            @Override
            public void run() {
                new WindController();
            }
        };
        //GUI must start on EventDispatchThread:
        SwingUtilities.invokeLater(gui);
    }
}
